package cn.lili.modules.order.order.service;

import cn.lili.modules.order.order.entity.dos.OrderFlow;
import cn.lili.modules.order.order.entity.dos.OrderItem;
import cn.lili.modules.order.order.entity.dos.OrderItemFlow;
import cn.lili.modules.order.order.entity.dto.OrderItemFlowSearchParams;
import cn.lili.modules.order.order.entity.vo.OrderItemFlowUserVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * 子订单流水业务层
 *
 * @author Chopper
 * @since 2020/11/17 7:37 下午
 */
public interface OrderItemFlowService extends IService<OrderItemFlow> {

    /**
     * 生成子订单流水
     *
     * @param orderItems 子订单
     * @param orderFlow  主订单流水
     */
    Boolean generateOrderItemFlow(List<OrderItem> orderItems, OrderFlow orderFlow);

    /**
     * 根据订单号和skuId获取子订单流水
     *
     * @param orderSn 订单号
     * @param skuId   skuId
     * @return 子订单流水
     */
    OrderItemFlow getByOrderSnAndSkuId(String orderSn, String skuId);

    /**
     * 根据查询参数获取子订单流水
     *
     * @param searchParams 查询参数
     * @return 子订单流水
     */
    Page<OrderItemFlowUserVO> getOrderFlowUserVOByCondition(OrderItemFlowSearchParams searchParams);


    /**
     * 根据查询参数获取分销金额总计
     *
     * @param searchParams 查询参数
     * @return 分销金额总计
     */
    Long amountOderFlowUserVOByCondition(@RequestBody OrderItemFlowSearchParams searchParams);
}